package com.cjhedu.web.advice;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.stereotype.Component;

/**
 * @author 陈佳豪
 * @version 1.0
 * aop 面向切面变成
 */
@Component
@Aspect
public class MyAspect {
    @Around("execution(* com.cjhedu.web.service.impl.*.*(..))")
    public Object totalTime(ProceedingJoinPoint pjp) throws Throwable {
        //增强逻辑
        long start = System.currentTimeMillis();
        Object o = pjp.proceed();
        long end = System.currentTimeMillis();
        System.out.println(pjp.getSignature().getDeclaringTypeName()+"类中的" + pjp.getSignature().getName() +"方法执行花费时间为：" + (end-start) + "毫秒====");
        return o;




    }
}
